//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.tm.chargecar.controller;

import com.tm.chargecar.conf.OperationLog;
import com.tm.chargecar.entity.WarnEntity;
import com.tm.chargecar.vo.WarnVo;
import com.tm.chargecar.enums.OperationTypeEnum;
import com.tm.chargecar.result.Result;
import com.tm.chargecar.service.WarnService;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping({"warn"})
public class WarnController {
    @Autowired
    private WarnService warnService;

    /**
     * 查询告警记录的方法
     * @param warnVo
     * @return
     */
    @GetMapping({"queryWarn"})
    @OperationLog(
            operationModule = "jack",
            operationType = OperationTypeEnum.QUERY,
            description = "查询告警信息"
    )
    public Result queryWarn(WarnVo warnVo) {
        List<WarnEntity> list = this.warnService.queryWarn(warnVo);
        return Result.SUCCESS(list);
    }

    /**
     * 增加告警记录的方法
     * @param warnEntity
     * @return
     */
    @PostMapping({"addWarn"})
    @OperationLog(
            operationModule = "jack",
            operationType = OperationTypeEnum.INSERT,
            description = "新增告警信息"
    )
    public Result addWarn(@RequestBody WarnEntity warnEntity) {
        this.warnService.addWarn(warnEntity);
        return Result.SUCCESS();
    }
}
